<div class="latesthreads">
	Latest Forum Threads<br /><br />

	<?php
		/* Check if both latest threads are from the same thread */
		$threadIds[0] = ($latest_threads[0]['Thread']['thread_id'] == "0") ? $latest_threads[0]['Thread']['id'] : $latest_threads[0]['Thread']['thread_id'];
		$threadIds[1] = ($latest_threads[1]['Thread']['thread_id'] == "0") ? $latest_threads[1]['Thread']['id'] : $latest_threads[1]['Thread']['thread_id'];
		$first = 1;
		foreach($latest_threads as $thread){
			if($threadIds[0] == $threadIds[1]){
				$subtract = ($first === 1) ? 1 : -1;
			}else{
				$subtract = 0;
			}
			echo $this->Html->link(
				trim($thread['Thread']['title']),
				array(
					'controller' => 'threads',
					'action' => 'view',
					'id' => ($thread['Thread']['thread_id'] == 0) ? $thread['Thread']['id'] : $thread['Thread']['thread_id'],
					'slug' => Inflector::slug($thread['Thread']['title'], '-'),
					'page' => (empty($thread['Parent']['reply_count'])) ? 1 : ceil(($thread['Parent']['reply_count'] + $subtract) / 10),
					'#' => $thread['Thread']['id']
				)
			);
			echo " ";
			echo $thread['User']['username'];
			$first = 0;
			echo '<br />';
		}
	?>
	<br style="clear: both" />
</div>